﻿using System;

namespace Core
{
    /// <summary>
    /// Post options. Options which are displayed in the UI.
    /// </summary>
    public class PostOption
    {
        private string _authorName;
        private string _relImageFolder;

        public PostOption()
        {
            this.DownloadImages = false;
            this.IncludeDraft = false;
        }

        /// <summary>
        /// Gest or sets the DownloadImages. When true downloads the image form WP
        /// to the specified folder which is set in <see cref="LocalImageFolder"/>.
        /// </summary>
        public bool DownloadImages { get; set; }
        
        /// <summary>
        /// Gets or sets the IncludeDraft. When true the draft posts from WP will be included
        /// in BE.
        /// </summary>
        public bool IncludeDraft { get; set; }

        /// <summary>
        /// URL name including schema. This is the url of the blog. Is used to identify image href.
        /// <example>
        /// http://www.myblog.com
        /// </example>
        /// </summary>
        public string BlogUrl { get; set; }

        /// <summary>
        /// Gets or sets the path where the uploaded images are located.
        /// These are the images used in the posts content.
        /// </summary>
        public string LocalImageFolder { get; set; }

        /// <summary>
        /// Gets or sets the relative path to the images. This is the path used in posts to locate images.
        /// Something like website.com/image.axd?picture=img\sunset.jpg
        /// </summary>
        public string RelImageFolder
        {
            get
            {
                if (_relImageFolder == null)
                {
                    return String.Empty;
                }
                return _relImageFolder;
            }
            set { _relImageFolder = value; }
        }

        /// <summary>
        /// Gets or set PostAppDataLocation - where the posts BE files will be located.
        /// </summary>
        public string PostAppDataLocation
        {
            get;
            set;
        }

        /// <summary>
        /// The name the post appears under.
        /// </summary>
        public string AuthorName
        {
            get
            {
                if (String.IsNullOrEmpty(this._authorName))
                {
                    return "Admin";
                }

                return _authorName;
            }
            set { _authorName = value; }
        }

        /// <summary>
        /// Gets or sets if the downloaded image should be add a drop shadow effect.
        /// </summary>
        public bool AddImgDropShadow
        {
            get;
            set;
        }
    }
}